#ifndef __WIZ_UTILS_DATUM_READER_HPP__SHANHAOBO_19800429__
#define __WIZ_UTILS_DATUM_READER_HPP__SHANHAOBO_19800429__

#include "../../Base/WizBase.hpp"
#include "../../DataType/WizDataType.hpp"

namespace Wiz
{
    namespace Datum
    {
        namespace Reader
        {
            struct Type
            {
            public:
                Type()
                {}
                virtual ~Type()
                {}
            protected:
                virtual ::Wiz::Void::Type Locate(::Wiz::String::In StrName) = 0;
                virtual ::Wiz::Bool::Type Read(::Wiz::Real32::Out)  = 0;
                virtual ::Wiz::Bool::Type Read(::Wiz::Real64::Out)  = 0;
                virtual ::Wiz::Bool::Type Read(::Wiz::Int8::Out)    = 0;
                virtual ::Wiz::Bool::Type Read(::Wiz::Int16::Out)   = 0;
                virtual ::Wiz::Bool::Type Read(::Wiz::Int32::Out)   = 0;
                virtual ::Wiz::Bool::Type Read(::Wiz::Int64::Out)   = 0;
                virtual ::Wiz::Bool::Type Read(::Wiz::UInt8::Out)   = 0;
                virtual ::Wiz::Bool::Type Read(::Wiz::UInt16::Out)  = 0;
                virtual ::Wiz::Bool::Type Read(::Wiz::UInt32::Out)  = 0;
                virtual ::Wiz::Bool::Type Read(::Wiz::UInt64::Out)  = 0;
                virtual ::Wiz::Bool::Type Read(::Wiz::Boolean8::Out)   = 0;
                virtual ::Wiz::Bool::Type Read(::Wiz::String::Out)  = 0;
            public:
                /// Read from stream
                template<class OutT>
                ::Wiz::Bool::Type Read(::Wiz::String::In StrName, OutT& Dt)
                {
                    Locate(StrName);
                    Read(Dt);
                }
                template<class OutT>
                ::Wiz::Bool::Type Read(::Wiz::String::In StrName, OutT* DtPtr, ::Wiz::Size32::In Sz)
                {
                    ::Wiz::Size32::Type i;

                    Locate(StrName);
                    for (i = 0; i < Sz; i++)
                    {
                        Read(DtPtr[i]);
                    }
                }
                template<class OutT>
                ::Wiz::Bool::Type Read(::Wiz::String::In StrName, ::Wiz::Array::Type<OutT> DtArry, ::Wiz::Size32::In Sz)
                {
                    OutT Temp;
                    ::Wiz::Size32::Type i;

                    Locate(StrName);
                    for (i = 0; i < Sz; i++)
                    {
                        Read(Temp);
                        DtArry.PushBack(Temp);
                    }
                }
                template<class OutT>
                ::Wiz::Bool::Type Read(::Wiz::String::In StrName, ::Wiz::List::Type<OutT> DtLst, ::Wiz::Size32::In Sz)
                {
                    OutT Temp;
                    ::Wiz::Size32::Type i;

                    Locate(StrName);
                    for (i = 0; i < Sz; i++)
                    {
                        Read(Temp);
                        DtLst.PushBack(Temp);
                    }
                }
                template<class OutT>
                ::Wiz::Bool::Type Read(::Wiz::String::In StrName, ::Wiz::Set::Type<OutT> DtSt, ::Wiz::Size32::In Sz)
                {
                    OutT Temp;
                    ::Wiz::Size32::Type i;

                    Locate(StrName);
                    for (i = 0; i < Sz; i++)
                    {
                        Read(Temp);
                        DtSt.Insert(Temp);
                    }
                }
                template<class OutT>
                ::Wiz::Bool::Type Read(::Wiz::String::In StrName, ::Wiz::Deque::Type<OutT> DtDq, ::Wiz::Size32::In Sz)
                {
                    OutT Temp;
                    ::Wiz::Size32::Type i;

                    Locate(StrName);
                    for (i = 0; i < Sz; i++)
                    {
                        Read(Temp);
                        DtDq.PushBack(Temp);
                    }
                }
                template<class IndexT, class ValueT>
                ::Wiz::Bool::Type Read(::Wiz::String::In StrName, ::Wiz::Map::Type<IndexT, ValueT> DtMp, ::Wiz::Size32::In Sz)
                {
                    IndexT Index;
                    ValueT Value;
                    ::Wiz::Size32::Type i;

                    Locate(StrName);
                    for (i = 0; i < Sz; i++)
                    {
                        Read(Index);
                        Read(Value);
                        DtMp.Insert(Index, Value);
                    }
                }
                template<class IndexT, class ValueT>
                ::Wiz::Bool::Type Read(::Wiz::String::In StrName, ::Wiz::MultiMap::Type<IndexT, ValueT> DtMMp, ::Wiz::Size32::In Sz)
                {
                    IndexT Index;
                    ValueT Value;
                    ::Wiz::Size32::Type i;

                    Locate(StrName);
                    for (i = 0; i < Sz; i++)
                    {
                        Read(Index);
                        Read(Value);
                        DtMMp.Insert(Index, Value);
                    }
                }
            };
            WIZ_DECLARE(::Wiz::Datum::Reader::Type);

            namespace Endian
            {
                
            } /// end of namespace Endian
        } /// end of namespace Reader
    } /// end of namespace Datum
} /// end of namespace Wiz

#endif /*__WIZ_UTILS_DATUM_READER_HPP__SHANHAOBO_19800429__*/
